CC = gcc
CFLAGS = -I include
LDFLAGS = -L lib -lcal

SRC = src/main.c src/add.c src/sub.c
OBJ = src/main.o src/add.o src/sub.o
LIB = lib/libcal.a

all: main

main: $(OBJ) $(LIB)
	$(CC) $(OBJ) -o main $(LDFLAGS)

$(LIB): lib/add.o lib/sub.o
	ar rcs $(LIB) lib/add.o lib/sub.o

lib/add.o: src/add.c
	$(CC) $(CFLAGS) -c src/add.c -o lib/add.o

lib/sub.o: src/sub.c
	$(CC) $(CFLAGS) -c src/sub.c -o lib/sub.o

clean:
	rm -f $(OBJ) $(LIB) main


